<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Blog
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 * @version    $Id: Core.php 9072 2011-07-21 01:09:21Z john $
 * @author     Jung
 */

/**
 * @category   Application_Extensions
 * @package    Blog
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 */
class Fan_Api_Core extends Core_Api_Abstract
{
    
    public function isFan($subject){
        $viewer = Engine_Api::_()->user()->getViewer();
        $table = Engine_Api::_()->getDbTable('fans','fan');
        $select = $table->select()->where('follower_id = ?',$viewer->getIdentity())->where('resource_id = ?',$subject->getIdentity());
        $fan = $table->fetchRow($select);
        if($fan instanceof Fan_Model_Fan){
            return $fan;
        }
        return false;
    }
  
}